package test;

import command.simple.*;

public class RemoteControlMain {
    public static void main(String[] args) {
        //创建一个遥控器
        SimpleRemoteControl remote = new SimpleRemoteControl();

        //创建一个灯
        Light light = new Light();
        //创建一个灯的命令工具
        LightOnCommand lightOnCommand = new LightOnCommand(light);
        //设置遥控器的插槽功能
        remote.setSlot(lightOnCommand);
        //按遥控器的按钮,发出命令
        remote.buttonWasPressed();

        //创建一个车库门
        GarageDoor garageDoor = new GarageDoor();
        //创建一个车库门的命令工具
        GarageDoorOpenCommand garageDoorOpenCommand = new GarageDoorOpenCommand(garageDoor);
        //设置遥控器的插槽功能
        remote.setSlot(garageDoorOpenCommand);
        //按遥控器的按钮,发出命令
        remote.buttonWasPressed();
    }
}
